package dominio.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dominio.controlador.CtrlLogin;

public class LoginServlet extends HttpServlet {

	private static final long serialVersionUID = 8024442796696381972L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
			CtrlLogin ctrlLogin = new CtrlLogin(request, response, getServletContext());
			ctrlLogin.iniciarTelaLogin();
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		String local = request.getParameter("local");
		if (local.equals("logar")) {
			String usuario = request.getParameter("usuario");
			String senha = request.getParameter("senha");
			
			CtrlLogin ctrlLogin = new CtrlLogin(request, response, getServletContext());
			ctrlLogin.efetuarLogin(usuario, senha);
		}
	}

}
